package net.zhuike.novel.app.ui.activity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import net.zhuike.novel.app.R;
import net.zhuike.novel.app.manager.SettingManager;
import net.zhuike.novel.app.ui.base.Constant;
import net.zhuike.novel.app.ui.view.KeywordsFlow;
import net.zhuike.novel.app.ui.view.LabelView;

import java.util.Random;

import framework.common.baseui.UeBaseActivity;

/**
 * Created by wq on 2017/6/17.
 * 第一次进入app选择类别
 */
public class ChooseLikeTypeActivity extends Activity {
    private LabelView mLabelView;
    private KeywordsFlow keywordsFlow;
    private LinearLayout like_bottom;
    String []keywords ;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_choose_like_type);
        keywordsFlow = (KeywordsFlow) findViewById(R.id.keywordsFlow);
        like_bottom= (LinearLayout) findViewById(R.id.like_bottom);
        refreshTags();
    }
    private void refreshTags() {
        keywords= new String[]{"玄幻","武侠","历史", "男", "女", "恐怖", "言情"};
        keywordsFlow.setDuration(800l);
        keywordsFlow.setOnItemClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                String keyword = ((TextView) v).getText().toString();// 获得点击的标签

            }
        });
        // 添加
        feedKeywordsFlow(keywordsFlow, keywords);
        keywordsFlow.go2Show(KeywordsFlow.ANIMATION_IN);
    }
    private static void feedKeywordsFlow(KeywordsFlow keywordsFlow, String[] arr) {
        Random random = new Random();
        for (int i = 0; i < KeywordsFlow.MAX; i++) {
            int ran = random.nextInt(arr.length);
            String tmp = arr[ran];
            keywordsFlow.feedKeyword(tmp);
        }
    }
    public void onClick(View view){
        switch (view.getId()){
            case R.id.like_bottom:
                SettingManager.getInstance().saveUserChooseSex(Constant.Gender.MALE);
                startActivity(new Intent(ChooseLikeTypeActivity.this, MainActivity.class));
                finish();
                break;
        }
    }
}
